<template>
    <div class="X-root">
    
        <!-- 非购买的 -->
        <Headers></Headers>
        <div class="X-top" v-if='myTop.photo'>
            <img class="t1-img" :src='myTop.photo.path' />
            <div class='tt-box'>
                <h2 style='margin-bottom:5px;'>{{myTop.msg}}</h2>
                <!-- 购买 -->
                <div class="t-box" v-if="myTop.item">
                    <div class="t-img">
                        <img src='../assets/tao.png' />
                        <div class="ss-h3">
                            <p>{{myTop.source_title}}</p>
                            <h3 style="color:red;">￥ {{myTop.item.price}}</h3>
                        </div>
                    </div>
                    <button style='width:60px;'>去购买</a>
                    </button>
                </div>
                <hr/>
                <div class='tt-img'>
                    <!--<router-link :to="'/xianshi/'+item.id+'/'+item.album.id+'/geren/' +myTop.sender_id">-->
                    <img :src='myTop.sender.avatar' />
                    <!--</router-link>-->
                    <div class='tt-h4'>
                        <h4>
                            {{myTop.sender.username}}
                        </h4>
                        <span>收集到 {{myTop.album.name}}</span>
                    </div>
                    <span class="span">{{myTop.add_datetime_pretty}}</span>
                </div>
            </div>
        </div>
    
        <!-- 下面的请求 -->
        <div class="bots">
            <div class="x-bot" v-for='bot in myBot'>
                <router-link :to="'/xianshi/last/'+bot.id">
                    <img :src='bot.photo.path' />
                    <div class="b-box">
                        <p>{{bot.msg}}</p>
                        <span>★ {{bot.favorite_count}}</span>
                    </div>
                </router-link>
            </div>
        </div>
         <!--下面的导航-->
        <!--<div class="bot-tabbar" v-if='Chuxian'>
            <BotTabbar></BotTabbar>
        </div>-->
        <!-- 猜你喜欢 -->
        <div class="cai" v-show="!isShow">
            <div class="shang" v-for='cc in myCai'>
                <p>{{cc.name}}
                    <span>{{cc.like_count}}人喜欢 </span>
                </p>
                <div class="fas">
                    <img style='margin-right:5px;height:95px;width:95px;' v-for="ii in cc.covers" :src="ii" />
                </div>
            </div>
            <span class="fa fa-caret-down"></span>
            <button>点击查看更多</button>
        </div>
        <!-- 猜你喜欢(固定) -->
        <!--<div class="cai" v-show="isShow">
            <div class="shang">
                <p>显脸小发型推荐
                    <span>88924人喜欢 </span>
                </p>
                <div class=" fa">
                    <img src="../assets/1.jpeg" />
                    <img src="../assets/2.jpeg" />
                    <img src="../assets/3.jpeg" />
                </div>
                <p class="ppp">只要你会穿身高根本不是事
                    <span>93624人喜欢</span>
                </p>
                <div class="gao">
                    <img src="../assets/4.jpeg" />
                    <img src="../assets/5.jpeg" />
                    <img src="../assets/6.jpeg" />
                </div>
            </div>
            <button>点击查看更多</button>
        </div>-->
    
    </div>
</template>

<script>
import Headers from '../components/Headers'
import BotTabbar from '../components/BotTabbar'

export default {
    components: {
        Headers,
        BotTabbar
    },
    data() {
        return {
            myTop: {},  // 页面上面的请求
            myBot: [],   // 列表的请求
            myCai: [],    // 猜你喜欢
            isShow: true,  // 猜你喜欢
        }
    },
    // 用于调用发送请求的函数
    mounted() {
        this.requestTop();
        this.requestBot();
        console.log(this.$route.params);
        this.requestCai();
    },
    // 用于书写发送请求
    methods: {
        requestTop() {
            this.$http('dt/napi/blog/detail/?', {
                params: {
                    include_fields: ['top_like_users', 'top_forward_users', 'top_like_users', 'tags', 'top_comments', 'related_albums', 'extra_links', 'related_albums.covers', 'root_album', 'share_links', 'share_info', 'atest_events', 'extra_html'],
                    blog_id: this.$route.params.id
                }
            })
                .then(function (res) {
                    console.dir(res.data.data)
                    this.myTop = res.data.data
                }.bind(this))
        },
        requestBot() {
            this.$http('dt/napi/blog/list/by_root_album/?', {
                params: {
                    start: 0,
                    include_fields: ['sender', 'album'],
                    limit: 4,
                    album_id: this.$route.params.albumid,
                    blog_id: this.$route.params.id,
                    _: 1497421663132,
                }
            })
                .then(function (res) {
                    console.dir(res.data.data.object_list)
                    this.myBot = res.data.data.object_list
                }.bind(this))
        },
        requestCai() {
            this.$http('dt/napi/album/list/by_related_blog/?', {
                params: {
                    blog_id: this.$route.params.id,
                }
            })
                .then(function (res) {
                    this.myCai = res.data.data.object_list
                    this.isShow = false
                }.bind(this))
        }
    }
}
</script>

<style scoped>
.X-root {
    box-sizing: border-box;
    background-color: #E0E0E0;
}

.X-top {
    width: 100%;
    background-color: #FFFFFF;
    box-sizing: border-box;
    padding: 10px;
}

.X-top .t1-img {
    width: 100%;
    height: 60%;
}

h2,
h4 {
    margin: 2px 0px -5px 0px;
    font-size: 14px;
}

h2 {
    color: black;
    font-weight: 100;
}

.tt-box {
    box-sizing: border-box;
    padding: 5px 15px;
}

hr {
    border: 1px solid #EFEFEF;
    margin: 2px;
}


/* 购买 */

.t-box {
    display: flex;
    justify-content: space-between;
    border-top: 0.5px solid #F2F2F2;
    padding-top: 3px;
    margin-top: 5px;
}

.t-img {
    display: flex;
    width: 70%;
}

.t-img img {
    width: 30px;
    height: 30px;
    border-radius: 7px;
    margin: 5px;
}

.t-img p,
h3 {
    margin: 2px;
}

.ss-h3 {
    width: 80%;
}

.ss-h3 p {
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ss-h3 h3{
    font-size: 18px;
    font-weight: 100;
}



/* 卖家 */

.tt-img {
    display: flex;
    box-sizing: border-box;
    padding: 10px;
    /*border-top: 0.5px solid #D5C5BE;*/
}

.tt-img img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin-right: 20px;
}

.tt-h4 {
    box-sizing: border-box;
    flex-basis: 65%;
}

.tt-h4 h4 {
    color: #50A6E0;
}

.tt-h4 span {
    font-size: 10px;
    color: black;
    margin-top: -4px;
    padding-bottom: 5px;
}

.span {
    font-size: 10px;
    color: #BEBEBE;
    padding-top: 4px;
    position: absolute;
    right: 25px;
}


/* 下面的设计 */

.bots {
    margin-top: 20px;
    display: flex;
    flex-wrap: wrap;
    width: 100%;
}

.x-bot {
    width: 47%;
    height: 60%;
    margin: 3px;
    background-color: white;
}

.b-box {
    width: 100%;
    background-color: white;
    font-size: 12px;
    color: #D2D2D2;
}

.b-box p {
    margin: 0px;
    color: grey;
}


/* 猜你喜欢(固定) */
.cai {
    margin-top: 20px;
    width: 100%;
    height: 50%;
    background-color: #585858;
    box-sizing: border-box;
    padding: 10px;
    position: relative;
}

.shang {
    box-sizing: border-box;
    padding: 0px 20px 10px 20px;
    background-color: white;
    border-bottom: 0.5px solid #F5F5F5;
}

.shang p {
    margin: 0px 0px 10px;
    color: grey;
    font-size: 14px;
    padding-top: 10px;
}

.shang p span {
    position: absolute;
    right: 45px;
    font-size: 12px;
}
.fa-caret-down{
    padding-bottom: 0px;
    position: absolute;
    bottom:45px;
    left: 50%;
    color: white;
}























.fas {
    display: flex;
    justify-content: space-between;
    padding-bottom: 10px;
    /*border-bottom: 1px solid #f5f5f5;*/
}

.gao {
    display: flex;
    justify-content: space-between;
}

.gao img {
    width: 30%;
    height: 100px;
}

button {
    width: 100%;
    height: 36px;
    line-height: 18px;
    margin: 5px 0px;
    background-color: #E75A46;
    border: 0.5px solid grey;
    border-radius: 3px;
    color: white;
}

.shang .fa img {
    width: 30%;
    height: 100px;
}


/* 底部导航栏 */

.bot-tabbar {
    position: fixed;
    bottom: 0px;
}
</style>
